package com.microservice.salmon.db.enums;

import lombok.Getter;

/**
 * 订单来源 0:商城 1:微信 2:手机版 3:安卓App 4:苹果App
 */
@Getter
public enum OrderFromEnum {
    WEB("0","商城"),
    WEIXIN("1","微信"),
    WAP("2","手机版"),
    ANDRIOD_APP("3","安卓App"),
    APPLE_APP("4","苹果App");

    private Byte code;
    private String message;
    OrderFromEnum(String code, String message) {
        this.code = Byte.valueOf(code);
        this.message = message;
    }

    public static OrderFromEnum codeOf(Byte code){
        for(OrderFromEnum orderStatusEnum : values()){
            if(orderStatusEnum.getCode().equals(code)){
                return orderStatusEnum;
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }
}